//定义一个用来描述自定义页面的实体类
export default class CustPage {
    id = "";
    title = "";
    type = "";
    createTime = "";
    updateTime = "";
    state = "";
    path = "";
    intervalTime = "";
    pageIsShow = true;
    mainTitle = "";
    subTitle = ""
    // tempalte = "";
    constructor(data) {
        this.init(data);
    }
    /**
     * 根据传进来的data初始化实体类
     * @param {Object|String} data 
     */
    init(data) {
        if (typeof data === "string") {
            data = JSON.parse(data);
        }
        for (let key in data) {
            //拼出set的方法名
            let firstLetter = key.slice(0, 1).toUpperCase();
            let restPart = key.slice(1);
            let name = `set${firstLetter}${restPart}`;
            // console.log("方法名", name);
            this[name] && this[name](data[key]);
        }
    }
    setId(id) {
        this.id = id;
    }
    setTitle(title) {
        this.title = title;
    }
    setType(type) {
        this.type = type;
    }
    setCreateTime(createTime) {
        this.createTime = createTime;
    }
    setUpdateTime(updateTime) {
        this.updateTime = updateTime;
    }
    setState(state) {
        this.state = state;
    }
    setPath(path) {
        this.path = path;
    }
    setIntervalTime(intervalTime) {
        this.intervalTime = intervalTime;
    }
    setPageIsShow(pageIsShow) {
        this.pageIsShow = pageIsShow;
    }
    setMainTitle(mainTitle){
        this.mainTitle = mainTitle;
    }
    setSubTitle(subTitle){
        this.subTitle = subTitle
    }
    getId() {
        return this.id;
    }
} 